package interview.huawei.training.p33;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        StringBuilder sb = new StringBuilder();
        while(scanner.hasNextLine()) {
            String ip =  scanner.nextLine();
            String[] ip_str = ip.split("\\.");
            long num = 0;
            for(int i = 3; i >= 0; i--) {
                num |= Long.parseLong(ip_str[3 - i]) << 8 * i;
            }
            System.out.println(num);
            num = Long.parseLong(scanner.nextLine());
            for(int i = 0; i < 4; i++) {
                sb.append(num >> 8 * (3 - i) & 255);
                if(i != 3) {
                    sb.append(".");
                }
            }
            
            System.out.println(sb);
            sb.delete(0, sb.length());
        }
    }
}